//
// Created by MacBook on 2019-12-09.
//

#include "ndkTest.h"
#include "jni.h"
#include <android/asset_manager_jni.h>
#include <android/asset_manager.h>
#include <malloc.h>
#include <string.h>

JNIEXPORT jstring JNICALL
Java_com_example_opengldemo_ndk_MyNDKView_getstr(JNIEnv *env, jobject instance, jstring name_,
                                                 jstring name2_) {
    const char *name = (*env)->GetStringUTFChars(env , name_, 0);
    const char *name2 = (*env)->GetStringUTFChars(env , name2_, 0);

    char *string = (char *) malloc(strlen(name) + strlen(name2));
    strcpy(string, name);
    strcat(string, name2);

    (*env)->ReleaseStringUTFChars(env, name_, name);
    (*env)->ReleaseStringUTFChars(env , name2_, name2);

    return (*env)->NewStringUTF(env , string);
}
